package cn.codesugar.videocache

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class SharedCacheActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_multiple_videos)
        addVideoFragment("https://codesugar.cn/res/%E5%A5%A5%E8%BF%AAA4.mp4", R.id.videoContainer0)
        addVideoFragment("https://codesugar.cn/res/%E5%A5%A5%E8%BF%AAA4.mp4", R.id.videoContainer1)
        addVideoFragment("https://codesugar.cn/res/%E5%A5%A5%E8%BF%AAA4.mp4", R.id.videoContainer2)
    }

    private fun addVideoFragment(url: String, containerViewId: Int) {
        supportFragmentManager
            .beginTransaction()
            .add(containerViewId, VideoFragment(url))
            .commit()
    }
}